<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePatentEvaluationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('patent_evaluations', function (Blueprint $table) {
            $table->id();
            $table->integer('patent_apply_id')->comment('申请ID');
            $table->integer('user_id')->default(0)->comment('负责人ID');
            $table->integer('department_id')->default(0)->comment('院系ID');
            $table->integer('expert_id')->comment('专家ID');
            $table->string('file')->nullable()->comment('评估报告');
            $table->text('remark')->nullable()->comment('评估意见');
            $table->float('score')->default(0)->comment('评分');
            $table->text('data')->nullable()->comment('评分详情');
            $table->timestamps();

            $table->index('patent_apply_id');
            $table->index('expert_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('patent_evaluations');
    }
}
